package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.CityQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.CityDao;
import com.bbdjt.weixin.model.City;
import com.bbdjt.weixin.service.CityService;

@Service("cityService")
public class CityServiceImpl extends BaseServiceImpl<City> implements CityService {
	
	@Override
    public List<City> selectByCity(City city, int page, int rows) {
        Example example = new Example(City.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(city);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<City> selectByCity(City city) {
        Example example = new Example(City.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(city);
        return selectByExample(example);
    }

    @Override
    public PageInfo<CityQueryModel> selectByCityQueryModel(CityQueryModel city) {
    	return ((CityDao) getMapper()).selectByCityModel(city);
    }

	@Override
	public List<City> selectByCity(CityQueryModel city) {
		  Example example = new Example(City.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(city);
	        PageHelper.startPage(city.getPageNum(), city.getPageSize(),city.getOrderBy());
	        return selectByExample(example);
	}

	
}